/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yunhoo.sys.util.common;

import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
import javax.faces.application.Application;
import javax.faces.context.FacesContext;

/**
 *
 * @author Administrator
 */
public class NavigationTool {

    public static void getSelectedUrl(String pageUrl) {
        FacesContext context = FacesContext.getCurrentInstance();
        Application application = context.getApplication();
        ExpressionFactory express = application.getExpressionFactory();
        ValueExpression ve = express.createValueExpression(context.getELContext(), "#{sysmenu.selectedPageUrl}", String.class);
        //检查是否具有pageUrl的操作权限
//        String oper=SysAdminTool.operator();
//        String auth=RoleAuthorizationImpl.getAuthorization(pageUrl, oper);
//        if(null!=auth&&!auth.equals("")){
//              ControlButton control=(ControlButton)FacesUtils.getManagedBean("controlbutton");
//                control.setAuth(auth);
//        }else{
//                pageUrl="/admin/noauthorization.xhtml";
//        }
        ve.setValue(context.getELContext(), pageUrl);
    }
}
